package com.knight.admin.service;

import java.util.List;

import com.knight.admin.model.Menu;
import com.knight.admin.model.Project;

public class MenuService {

	private final static Menu dao = new Menu().dao();

	private static MenuService instance = new MenuService();

	private MenuService() {
	}

	public static MenuService getInstance() {
		return instance;
	}

	/**
	 * 查找父级菜单
	 * 
	 * @return
	 */
	public List<Menu> findParentMenu() {
		return dao.find("SELECT * FROM menu WHERE TYPE = '1'");
	}

	/**
	 * 通过类型和父级Id
	 * 
	 * @param type
	 * @param parentId
	 * @return
	 */
	public List<Menu> findMenuByparentId(String type, String parentId) {
		List<Menu> list = dao
				.find("SELECT * FROM menu WHERE TYPE=" + type + " AND parentId=" + parentId + " ORDER BY sortValue");
		return list;
	}

}
